import {addOutput} from '../outputs';

export class ArtifactDocker {
    type: string;
    artifact: string;
    DOCKER_URL: string;
    dockerUrl: string;
    dockerTag: string;

    constructor(params: { artifact: string; image: string; dockerTag: string }) {
        this.type = "docker_image";
        this.artifact = params.artifact;
        this.DOCKER_URL = params.image;
        this.dockerUrl = params.image;
        this.dockerTag = params.dockerTag;
    }
}


export function exportArtifactDocker(artifactKey: string, artifact: ArtifactDocker): void {
    addOutput(`${artifactKey}=${JSON.stringify(artifact)}`);
}

export class CustomArtifactDocker {
    DOCKER_URL: string;

    constructor(params: { dockerURL: string }) {
        this.DOCKER_URL = params.dockerURL;
    }
}

export function exportCustomArtifactDocker(artifactName: string, artifact: CustomArtifactDocker): void {
    addOutput(`${process.env.stepIdentifier}.${artifactName}=${JSON.stringify(artifact)}`);
}

export class CustomArtifact {
    ARTIFACT_URL: string;

    constructor(params: { artifactURL: string }) {
        this.ARTIFACT_URL = params.artifactURL;
    }
}

export function exportCustomArtifact(artifactKey: string, artifact: CustomArtifact): void {
    addOutput(`${process.env.stepIdentifier}.${artifactKey}=${JSON.stringify(artifact)}`);
}